<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags/sys" prefix="sys"%>
<%@ taglib uri="/WEB-INF/tlds/webui.tld" prefix="webui"%>

<jsp:include page="editCpContent.jsp" />

<%--采纳状态 --%>
<webui:enum var="isAdoptedType" code="isAdoptedType" appendJs="true"/>
<%--是否独家 --%>
<webui:enum var="exclusiveType" code="exclusive" appendJs="true"/>
<%--内容分类 --%>
<webui:enum var="contentType" code="contentType" appendJs="true"/>
<%--内容状态 --%>
<webui:enum var="statusType" code="statusType" appendJs="true"/>

<c:forEach items="${contentType }" var="type">
	<webui:enum var="${type.key }Area" code="${type.key }Area" appendJs="true"/>
	<webui:enum var="${type.key }Type" code="${type.key }Type" appendJs="true"/>
</c:forEach>

<style>
.details {
	padding-top: 10px;
}
</style>

<script>
function loadDateCount(table,data){
	var contentCount = data.page.totalElements;
	if(!document.getElementById("table_length")){
		$("#grid_cpContent_paginate").parent().prev().append("<div id='table_length' style='float:left'></div>");
	}
	if (contentCount > 0) {
		$("#table_length").html("共"+contentCount+"条数据");
	} else {
		$("#table_length").html("");
	}
}
</script>

<webui:panel id="cpContentSearch">
	<webui:form styleClass="form-horizontal" id="cpContentSearchForm"
		action="${contextPath}/declare/content/findContent.action"
		name="cpContentSearchForm" method="post">
		<div class="col-sm-12">
			<input type="hidden" name="orderBy" id="orderBy"/>
			<input type="hidden" name="field" id="field"/>
			<webui:input label="节目名" styleClass="col-sm-4" inputClass="col-sm-9"
				labelClass="col-sm-3" type="text" name="name">
			</webui:input>

			<webui:select label="内容分类" name="contentType" id=""
				styleClass="col-sm-4" labelClass="col-sm-3" inputClass="col-sm-9"
				lookup="${contentType}">
			</webui:select>

			<webui:select label="内容状态" name="status" id="" styleClass="col-sm-4"
				labelClass="col-sm-3" inputClass="col-sm-9" lookup="${statusType}">
			</webui:select>
		</div>
		<div class="col-sm-12">
			<webui:select label="采纳状态" name="isAdopted" id=""
				styleClass="col-sm-4" labelClass="col-sm-3" inputClass="col-sm-9"
				lookup="${isAdoptedType}">
			</webui:select>

			<webui:select label="是否独家" name="exclusive" id="exclusive"
				styleClass="col-sm-4" labelClass="col-sm-3" inputClass="col-sm-9"
				lookup="${exclusiveType}">
			</webui:select>

			<webui:datepicker label="录入时间" styleClass="col-sm-4"
				labelClass="col-sm-3" inputClass="col-sm-9"
				beginName="createTimeBegin" beginId="" endName="createTimeEnd"
				endId="" duration="true">
			</webui:datepicker>
		</div>
		<div class="col-sm-12">
			<webui:datepicker label="申报时间" styleClass="col-sm-4"
				labelClass="col-sm-3" inputClass="col-sm-9"
				beginName="declareTimeBegin" beginId="" endName="declareTimeEnd"
				endId="" duration="true">
			</webui:datepicker>

			<webui:datepicker label="上线时间" styleClass="col-sm-4"
				labelClass="col-sm-3" inputClass="col-sm-9"
				beginName="onlineTimeBegin" beginId="" endName="onlineTimeEnd"
				endId="" duration="true">
			</webui:datepicker>

			<webui:button label="" type="button" styleClass="col-sm-2"
				labelClass="col-sm-7" inputClass="col-sm-5"
				buttonClass="btn-primary" onclick="grid_cpContent.filter()">查询
			</webui:button>
			<webui:button label="" type="button" styleClass="col-sm-2"
				labelClass="col-sm-7" inputClass="col-sm-5"
				buttonClass="btn-primary" onclick="createContent()">内容录入
			</webui:button>
		</div>
	</webui:form>

	<webui:table id="grid_cpContent"
		dataUrl="${contextPath}/declare/content/findContent.action"
		datas="data" editorForm="#editCpContent" dataload="loadDateCount"
		searchForm="#cpContentSearch">
		<webui:column editor="tableCheck" format="row.id" title="row.status+','+row.isAdopted"></webui:column>
		<webui:column field="name" title="片名">
			<a class="btn btn-xs btn-link" v-bind:href="'javascript:contentDetails('+row.id+')'">{{row.name}}</a>
		</webui:column>
		<webui:column field="createTime" title="录入时间">{{row.createTime | moment('YYYY-MM-DD HH:mm:ss')}}</webui:column>
		<webui:column field="declareTime" title="申报时间">{{row.declareTime | moment('YYYY-MM-DD HH:mm:ss')}}</webui:column>
		<webui:column field="onlineTime" title="上线时间">{{row.onlineTime | moment('YYYY-MM-DD HH:mm:ss')}}</webui:column>
		<webui:column field="contentType" title="分类" lookup="${contentType }">{{row.contentTypeDesc}}</webui:column>
		<webui:column field="exclusive" title="是否独家" lookup="${exclusiveType }">{{row.exclusiveDesc}}</webui:column>
		<webui:column field="status" title="状态"  lookup="${statusType }" >{{row.statusDesc}}</webui:column>
		<webui:column field="isAdopted" title="采纳状态" lookup="${isAdoptedType }">{{row.isAdoptedDesc}}</webui:column>
		<webui:column field="" title="操作">
			<a v-if="row.status==0" class="btn btn-xs btn-success"
				v-bind:href="'javascript:openDeclareContent('+row.id+',\''+row.name+'\')'">申报</a>
			<a v-if="row.status==1" class="btn btn-xs btn-info"
				v-bind:href="'javascript:onLineContent('+row.id+',\''+row.name+'\')'">上线</a>
			<a class="btn btn-xs btn-primary"
				v-bind:href="'javascript:editContent('+row.id+')'">修改</a>
			<a v-if="row.isAdopted==3 || row.isAdopted==0" class="btn btn-xs btn-danger"
				v-bind:href="'javascript:deleteContent('+row.id+',\''+row.name+'\')'">删除</a>
		</webui:column>
	</webui:table>
	<div class="row">
		<div class="col-md-7" style="float: left;">
			<webui:button type="button" buttonClass="btn-primary" ladda="true"
				onclick="declares()">批量申报</webui:button>
			<webui:button type="button" buttonClass="btn-primary" ladda="true"
				onclick="onLines()">批量上线</webui:button>
			<webui:button type="button" buttonClass="btn-primary" ladda="true"
				onclick="deletes()">批量删除</webui:button>
			<webui:button type="button" buttonClass="btn-primary" ladda="true"
				onclick="excelExport()">Excel导出</webui:button>
		</div>
	</div>
</webui:panel>

<%---------------------------------------------申报窗口start-----------------------------------------------%>
<div class="modal fade" id="declareContent" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content animated bounceInRight">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="declareDialogTitle">内容申报</h4>
			</div>
			<div class="modal-body">
				<webui:form method="get" id="declareContentForm"
					name="declareContentForm" styleClass="form-horizontal">
					<input type="hidden" id="fromDeclareId"
						name="id">
					<webui:input label="片名" labelClass="col-sm-3"
						inputClass="col-sm-9" type="text" styleClass="col-sm-12"
						name="name" id="declareContentName">
					</webui:input>

					<webui:datepicker label="预计上线时间" styleClass="col-sm-12"
						labelClass="col-sm-3" inputClass="col-sm-9"
						id="fromDeclarePlanOnlineTime" name="planOnlineTime">
						<webui:validator required="true"/>
					</webui:datepicker>
					<webui:datepicker label="授权时间" styleClass="col-sm-12"
						labelClass="col-sm-3" inputClass="col-sm-9"
						id="fromDeclareCopyrightTime" name="copyrightTime">
						<webui:validator required="true"/>
					</webui:datepicker>
				</webui:form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" id="declareBtn" onclick="declareContent()">确认</button>
			</div>
		</div>
	</div>
</div>
<%---------------------------------------------申报窗口end-----------------------------------------------%>

<%---------------------------------------------电影详情start-----------------------------------------------%>
<div class="modal fade" id="contentDetails" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 90%">
		<div class="modal-content bounceInRight">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="contentDetails"></h4>
			</div>
			<div>
				<div class="col-sm-12 details">
					<div class="col-sm-6">
						<strong>编号：</strong><span id="codeDetail"></span>
					</div>
					<div class="col-sm-6">
						<strong>外部编号：</strong><span id="externalCodeDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-3">
						<strong>片名：</strong><span id="nameDetail"></span>
					</div>
					<div class="col-sm-3">
						<strong>集数：</strong><span id="episodeNumDetail"></span>集
					</div>
					<div class="col-sm-3">
						<strong>年代：</strong><span id="yearsDetail"></span>
					</div>
					<div class="col-sm-3">
						<strong>评分：</strong><span id="ratingDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-12">
						<strong>导演：</strong><span id="directorDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-12">
						<strong>演员：</strong><span id="actorDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-4">
						<strong>类型：</strong><span id="typeDetail"></span>
					</div>
					<div class="col-sm-4">
						<strong>地区：</strong><span id="areaDetail"></span>
					</div>
					<div class="col-sm-4">
						<strong>分类：</strong><span id="contentTypeDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-12">
						<strong>简介：</strong><span id="introDetail"></span>
					</div>
				</div>
				<!-- 电视剧独有 -->
				<div>
					<div class="col-sm-12 details">
						<div class="col-sm-6">
							<strong>跳过开头：</strong><span id="startTimeDetail"></span>
						</div>
						<div class="col-sm-6">
							<strong>跳过结尾：</strong><span id="endTimeDetail"></span>
						</div>
					</div>
					<div class="col-sm-12 details">
						<div class="col-sm-12">
							<strong>备注：</strong><span id="remarksDetail"></span>
						</div>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-6">
						<strong>录入时间：</strong><span id="createTimeDetail"></span>
					</div>
					<div class="col-sm-6">
						<strong>申报时间：</strong><span id="declareTimeDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-6">
						<strong>计划上线时间：</strong><span id="planOnlineTimeDetail"></span>
					</div>
					<div class="col-sm-6">
						<strong>上线时间：</strong><span id="onlineTimeDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-6">
						<strong>是否独家：</strong><span id="exclusiveDetail"></span>
					</div>
					<div class="col-sm-6">
						<strong>授权时间：</strong><span id="copyrightTimeDetail"></span>
					</div>
				</div>
				<div class="col-sm-12 details">
					<div class="col-sm-6">
						<strong>状态：</strong><span id="statusDetail"></span>
					</div>
					<div class="col-sm-6">
						<strong>采纳状态：</strong><span id="isAdoptedDetail"></span>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>
<%---------------------------------------------电影详情end-----------------------------------------------%>

<script>
	$(function(){
		/******************************按照录入时间排序*************************************/
		var createOrderBy = "desc";
		$("#onlineTime_title").click(function(){
			$("#field").val("onlineTime");
			if(createOrderBy == "desc"){
				createOrderBy = "asc";
				$("#orderBy").val("asc");
			}else if(createOrderBy == "asc"){
				createOrderBy = "desc";
				$("#orderBy").val("desc");
			}
			if(!document.getElementById("onlineTimeOrderIcon")){
				$(this).append("<span id='onlineTimeOrderIcon' class='glyphicon'></span>");
			}
			if(document.getElementById("declareTimeOrderIcon")){
				$("#declareTimeOrderIcon").remove();
			}
			tableSort(createOrderBy,"onlineTime");
		});
		/******************************按照申报时间排序*************************************/
		var declareOrderBy = "desc";
		$("#declareTime_title").click(function(){
			$("#field").val("declareTime");
			if(declareOrderBy == "desc"){
				declareOrderBy = "asc";
				$("#orderBy").val("asc");
			}else if(declareOrderBy == "asc"){
				declareOrderBy = "desc";
				$("#orderBy").val("desc");
			}
			if(!document.getElementById("declareTimeOrderIcon")){
				$(this).append("<span id='declareTimeOrderIcon' class='glyphicon'></span>");
			}
			if(document.getElementById("onlineTimeOrderIcon")){
				$("#onlineTimeOrderIcon").remove();
			}
			tableSort(declareOrderBy,"declareTime");
		});
	});
	
	
	/******************************刷新数据并显示上下箭头*************************************/
	function tableSort(order,field){
		grid_cpContent.filter();
		if(order == "desc"){
			$("#"+field+"OrderIcon").removeClass("glyphicon-chevron-up");
			$("#"+field+"OrderIcon").addClass("glyphicon-chevron-down");
		}else if(order == "asc"){
			$("#"+field+"OrderIcon").removeClass("glyphicon-chevron-down");
			$("#"+field+"OrderIcon").addClass("glyphicon-chevron-up");
		}
		
	}
	
	/******************************添加按钮*************************************/
	function createContent() {
		$(".panel-heading").html("添加内容");
		var select = $("#editFromContentType").val();
		vodOrSeries(select, 'Area', '#editFromArea');
		vodOrSeries(select, 'Type', '#editFromType');
		$("#editFromCode").attr("readonly",false);
		$("#editFromExternalCode").attr("readonly",false);
		grid_cpContent.create();
	}

	/*******************************电影详情**********************************/
	function contentDetails(id){
		$.ajax({
			type : "GET",
			async : false,
			url : "${contextPath}/rest/cPContents/"+id,
			success : function(data){
				$("#codeDetail").html(data.code);
				$("#externalCodeDetail").html(data.externalCode);
				$("#nameDetail").html(data.name);
				$("#episodeNumDetail").html(data.episodeNum);
				$("#yearsDetail").html(data.years);
				$("#ratingDetail").html(data.rating);
				$("#directorDetail").html(data.director);
				$("#actorDetail").html(data.actor);
				$("#contentTypeDetail").html(contentType[data.contentType]);
				$("#areaDetail").html(areaDataJson(data.contentType)[data.area]);
				$("#typeDetail").html(typeDataJson(data.contentType,data.type));
				$("#introDetail").html(data.intro);
				$("#startTimeDetail").html(data.startTime);
				$("#endTimeDetail").html(data.endTime);
				$("#remarksDetail").html(data.remarks);
				$("#createTimeDetail").html(data.createTime);
				$("#declareTimeDetail").html(data.declareTime);
				$("#onlineTimeDetail").html(data.onlineTime);
				
				$("#planOnlineTimeDetail").html(data.planOnlineTime);
				$("#copyrightTimeDetail").html(data.copyrightTime);
				
				$("#exclusiveDetail").html(exclusiveType[data.exclusive]);
				$("#statusDetail").html(statusType[data.status]);
				var isAdopted = "";
				if(data.isAdopted!=null){
					isAdopted = isAdoptedType[data.isAdopted]
				}
				$("#isAdoptedDetail").html(isAdopted);
				$("#contentDetails").modal("show");
			}
		});
	}

	/*********************************修改************************************/
	function editContent(id) {
		$(".panel-heading").html("修改内容");
		$.ajax({
			type : "GET",
			async : false,
			url : "${contextPath}/rest/cPContents/"+id,
			success : function(data){
				grid_cpContent.create();
				$("#editFromContentId").val(data.id);
				$("#editFromContentType").val(data.contentType);
				vodOrSeries(data.contentType,'Area','#editFromArea');
				vodOrSeries(data.contentType,'Type','#editFromType');
				$("#editFromExclusive").val(data.exclusive+"");
				if(data.isAdopted!=3){
					$("#editFromExclusive").attr("disabled",true);
				}
				$("#editFromArea").val(data.area);
				
				$("#editFromType").val(stringToArray(data.type));
				$("#editFromType").trigger("chosen:updated");
				
				$("#editFromCode").val(data.code);
				$("#editFromExternalCode").val(data.externalCode);
				$("#editFromName").val(data.name);
				$("#editFromName").attr("readonly",true);
				$("#editFromDirector").val(data.director);
				$("#editFromActor").val(data.actor);
				$("#editFromYears").val(data.years);
				$("#editFromRating").val(data.rating);
				$("#editFromEpisodeNum").val(data.episodeNum);
				$("#editFromIntro").val(data.intro);
				$("#editFromStartTime").val(data.startTime);
				$("#editFromEndTime").val(data.endTime);
				$("#editFromRemarks").val(data.remarks);
			}
		});
	}
	/******************************申报***********************************/
	//申报面板关闭事件
	$('#declareContent').on("hidden.bs.modal", function(){
		$('#declareContentForm').reset();
		declareContentFormValidator.resetForm();
	});
	//打开申报面板
	function openDeclareContent(id, name) {
		$("#declareContentName_div").css("display", "block");
		$("#fromDeclareId").val(id);
		$("#declareContentName").val(name);
		$("#declareContentName").attr("readonly", true);
		$("#declareContent").modal("show");
	}
	
	function declareContent(){
		if(declareContentFormValidator.form()){
			var formData = $('form#declareContentForm').serializeJSON();
			var name = $("#declareContentName").val();
			var url = '${contextPath}/declare/cpContent/declare.action';
			if(name == ''){
				var ids = $("#fromDeclareId").val();
				var planOnlineTime = $("#fromDeclarePlanOnlineTime").val();
				var copyrightTime = $("#fromDeclareCopyrightTime").val();
				url = '${contextPath}/declare/cpContent/batchDeclare.action?ids='+ids+'&planOnlineTime='+planOnlineTime+'&copyrightTime='+copyrightTime;
			}
			console.log(url);
			$.ajax({
				method : "post",
				url : url,
				dataType : "json",
				contentType : "application/json; charset=utf-8",
				data : formData,
				success : function(data) {
					var message = '';
					if(name == ''){
						var errorList = data.data;
						message = '批量申报完成！<br/>请求全部成功!';
						if(errorList.length>0){
							message = '批量申报完成！<br/>成功'+data.result+'条，失败'+errorList.length+'条：'+errorList;
						}
					}else{
						message = name+'申报成功！';
					}
					
					showMessage('提示',message, function(){
						$('#declareContent').modal('hide');
						grid_cpContent.reload();
					});
					
				},
				error : function() {
					var message = name == ''?'批量申报失败，请重新尝试。':name+'申报失败，请重新尝试。';
					toastr.error(message);
					$('#declareContent').modal('hide');
				}
			});
		}
	}
	
	/******************************上线、删除***********************************/
	function onLineContent(id, name) {
		changeContentStatus("上线", id, name, "2");
	}

	function deleteContent(id, name) {
		changeContentStatus("删除", id, name, "-1");
	}

	function changeContentStatus(operate, id, name, status) {
		confirm("确定" + operate + name + "吗？", function() {
			var editType = "online";
			if(status=="-1"){
				editType = "delete";
			}
			$.ajax({
				method : "get",
				url : '${contextPath}/declare/cpContent/'+editType+'.action?rowId='+id,
				contentType : "application/json; charset=utf-8",
				success : function() {
					showMessage('提示',name+operate+'成功！', function(){
						grid_cpContent.reload();
					});
				}
			});
		});
	}
	
	/*******************************************批量操作start************************************************/
	//Excel导出
	function excelExport() {
		var datas = $("#cpContentSearchForm").serialize();
		$.ajax({
			method : "get",
			url : '${contextPath}/declare/cpContent/bathExport.action?'+datas,
			success : function(data){
				var fileName = data.data;
				var url = "${contextPath}"+fileName;
				window.open(url);
			}
		});
	}
	//申报
	function declares() {
		if (checlStatus("status",0)) {
			var checkeds = grid_cpContent.getCheckboxListObj();
			$("#declareContentName_div").css("display", "none");
			$("#fromDeclareId").val(checkeds);
			$("#declareContentName").val("");
			$("#declareContent").modal("show");
		} else {
			alert("请选择状态为待申报的内容！");
		}
	}
	//上线
	function onLines() {
		if (checlStatus("status",1)) {
			bathOnlineAndDelect("批量上线","online");
		} else {
			alert("请选择状态为待上线的内容！");
		}
	}
	//删除
	function deletes() {
		if (checlStatus("isAdopted",null)) {
			bathOnlineAndDelect("批量删除","delect");
		} else {
			alert("请选择采纳状态为空或未采纳的内容！");
		}
	}
	
	function bathOnlineAndDelect(operate,type){
		confirm("确定执行" + operate + "吗？", function() {
			var ids = grid_cpContent.getCheckboxListObj();
			var bath = "bathOnline";
			if(type == "delect"){
				bath = "bathDelete";
			}
			$.ajax({
				method : "get",
				url : '${contextPath}/declare/cpContent/'+bath+'.action?ids='+ids,
				success : function(data) {
					var errorList = data.data;
					var message = '<br/>请求全部成功！';
					if(errorList.length>0){
						message = '<br/>成功'+data.result+'条，失败'+errorList.length+'条：'+errorList;
					}
					showMessage('提示',operate+'完成！'+message, function(){
						grid_cpContent.reload();
					});
					
				},
				error : function() {
					toastr.error(operate+'失败。请重新尝试。');
					grid_cpContent.reload();
				}
			});
		});
	}
	
	//限制某种状态下只能做该做的事情
	function checlStatus(type,val){
		//得到选中项的id
		var checkeds = grid_cpContent.getCheckboxListObj();
		//根据id长度判断是否选中内容
		if (checkeds.length > 0) {
			var statusValues = "";//状态
			var isAdoptedValues = "";//采纳状态
			var titles = grid_cpContent.getCheckboxTitleList();
			titles.forEach(function(currentValue){
				var currentValueList = currentValue.split(",");
				statusValues += currentValueList[0];
				isAdoptedValues += currentValueList[1];
			},this);
			
			//当状态为0时可以申报，当状态为1时可以上线，0代表未申报状态，1代表未上线状态
			if(type=="status"){
				var reg = new RegExp("^[" + val + "]{" + titles.length + "}$");
				return reg.test(statusValues);
			}
			//当采纳状态为3或0时才可以删除，0代表未采纳，3代表初始状态
			if(type=="isAdopted"){
				var delectReg = new RegExp("^[0|3]{" + titles.length + "}$");
				return delectReg.test(isAdoptedValues);
			}
		} else {
			return false;
		}
	}
	/*******************************************批量操作end************************************************/
	
	
	/*****************************将分隔字符串通过逗号转换为数组********************************/
	function stringToArray(str){
		var typeArray = new Array();
		if(str!=""&&str!=null){
			typeArray = str.split(",");
		}
		return typeArray;
	}
	
	/*********************************去除字符串中的空格***********************************/
	function utilTrim(str,is_global){ 
		var result; 
		result = str.replace(/(^\s+)|(\s+$)/g,""); 
		if(is_global.toLowerCase()=="g") 
		result = result.replace(/\s/g,""); 
		return result; 
	}
	
	/***********************************电影详情中的地区**********************************/
	function areaDataJson(contentType){
		if(contentType=='series'){
			return seriesArea;
		}else if(contentType=='vod'){
			return vodArea;
		}else if(contentType=='variety'){
			return varietyArea;
		}else if(contentType=='documentary'){
			return documentaryArea;
		}
	}
	/***********************************电影详情中的类型**********************************/
	function typeDataJson(contentType,type){
		var cType;
		if(contentType=='series'){
			cType = seriesType;
		}else if(contentType=='vod'){
			cType = vodType;
		}else if(contentType=='variety'){
			cType = varietyType;
		}else if(contentType=='documentary'){
			cType = documentaryType;
		}
		
		var typeList = stringToArray(type);
		var typeItem="";
		typeList.forEach(function(item, index, arr){
			typeItem += cType[item]+"|";
		},this)
		return typeItem.substring(0,typeItem.length-1)
	}
</script>